<?php
/**
 * Created by Zend Studio.
 * User: FDG348
 * @param  FDG348 2018-03-23  553 【后台需求】用户在心愿单界面预约到店后，后台可查看用户预约到店时心愿单商品
 * Date: 2018/03/23
 * Time: 9:15
 */
namespace backend\models;

use yii\db\ActiveRecord;

class ShareWishList extends ActiveRecord{
    public static function tableName(){
        return '{{%share_wish_list}}';
    }

	const TYPE_ONE		=1;//分享二维码
	const TYPE_TWO		=2;//预约到店
	const TYPE_THR		=3;//打印

	public function rules(){
		return [
			[['member_id','goods_ids','type','create_time','share_key'],'safe'],
		];
	}
	
	/**
	 * @获取创建人
	 */
	public function getCreator(){
	    $userInfo = \common\helps\tools::getloginUserInfo();
	    if($userInfo){
	        $userName = $userInfo->userName;
	    }else{
	        $userName = '';
	    }
	    return $userName;
	}
	
	public function getShareWishReserv()
	{
	    return $this->hasOne(ShareWishReserv::className(), ['wish_list_id'=>'id']);
	}
}